package spring.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import spring.dao.UserDao;
import spring.domain.UserLog;
import spring.service.UserService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.ParseException;
import java.util.List;

@Controller
@RequestMapping("/log")
public class UserLogController {

    @RequestMapping("/all")
    public void allLogs(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException, ParseException {
        List<UserLog> userLogs;
        userLogs = (new UserService()).queryAllLogs();
        req.setAttribute("userLog", userLogs);
        req.getRequestDispatcher("/list.jsp").forward(req,response);
    }
}
